var indexModule = angular.module('indexModule',['commonModule']);

indexModule.directive('navbar', function() {
	return {
	    restrict: 'A',
	    scope: {},
	    replace: true,
	    link: function(scope, elem, attrs) {
	        scope.qcloud = {};
	        $('[_t_nav]').hover(function() {
	            var _nav = $(this).attr('_t_nav');
	            clearTimeout(scope.qcloud[_nav + '_timer']);
	            scope.qcloud[_nav + '_timer'] = setTimeout(function() {
	                $('[_t_nav]').each(function() {
	                    $(this)[_nav == $(this).attr('_t_nav') ? 'addClass' : 'removeClass']('nav-up-selected');
	                });
	                $('#' + _nav).stop(true, true).slideDown(200);
	            }, 150);
	        }, function() {
	            var _nav = $(this).attr('_t_nav');
	            clearTimeout(scope.qcloud[_nav + '_timer']);
	            scope.qcloud[_nav + '_timer'] = setTimeout(function() {
	                $('[_t_nav]').removeClass('nav-up-selected');
	                $('#' + _nav).stop(true, true).slideUp(200);
	            }, 150);
	        });
	    }

	};
});
